package com.gpframework;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/**
 * web容器中进行部署
 * 
 * @Author gpframework
 */
public class GpframeworkServletInitializer extends SpringBootServletInitializer
{
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
    {
        return application.sources(AdminApplication.class);
    }

    public static void main(String[] args) {
        int total = 147012;
        double price = calculatePrice(total);
        System.out.println("总条数: " + total + "，总费用: " + price + "元");
    }

    public static double calculatePrice(int total) {
        double price = 0;

        if (total < 20000) {
            price = total * 1.4;
        } else if(total>20000 && total<30000) {
            price = 20000 * 1.4 + ((total-20000)*1.2);
        } else if (total>30000){
            price =20000*1.4 + (((total-20000)/10000)*1.3*10000)+((total%10000)*1.2);
        }

        return price;
    }
}
